home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / var / lib / dpkg / info / wvdial.config < prev    next >
Text File  |  2008-05-19  |  2KB  |  86 lines

  1. #!/bin/sh
  2.  
  3. set -e
  4.  
  5. # Source debconf library
  6. . /usr/share/debconf/confmodule
  7.  
  8. db_capb backup
  9.  
  10. # Update the Debconf database with information from /etc/wvdial.conf
  11. if [ -e /etc/wvdial.conf ] && type uni >/dev/null 2>/dev/null; then
  12.     export UNICONF='ini:/etc/wvdial.conf'
  13.     update_db()
  14.     {
  15.         set +e
  16.     RET=`uni get "$1"`
  17.     if [ $? ]; then
  18.         set -e
  19.         db_set "$2" "$RET"
  20.     else
  21.         set -e
  22.     fi
  23.     }
  24. else
  25.     # We can't do anything
  26.     update_db()
  27.     {
  28.     true
  29.     }
  30. fi
  31.  
  32. STATE=1
  33. LASTSTATE=5
  34. while [ "$STATE" != 0 ] && [ "$STATE" -le "$LASTSTATE" ]; do
  35.     case "$STATE" in
  36.     1)
  37.         db_input low wvdial/wvdialconf || true
  38.             ;;
  39.     2)
  40.         db_get wvdial/wvdialconf
  41.         if [ "$RET" = "true" ]; then
  42.         update_db 'Dialer Defaults/Phone' wvdial/phone
  43.         db_input medium wvdial/phone || true
  44.         fi
  45.             ;;
  46.     3)
  47.         db_get wvdial/wvdialconf
  48.         if [ "$RET" = "true" ]; then
  49.         update_db 'Dialer Defaults/Username' wvdial/login
  50.         db_input medium wvdial/login || true
  51.         fi
  52.             ;;
  53.     4)
  54.         db_get wvdial/wvdialconf
  55.         if [ "$RET" = "true" ]; then
  56.         update_db 'Dialer Defaults/Password' wvdial/passphrase
  57.         update_db 'Dialer Defaults/Password' wvdial/passphrase2
  58.         db_input medium wvdial/passphrase || true
  59.         db_input medium wvdial/passphrase2 || true
  60.         fi
  61.             ;;
  62.     5)
  63.         db_get wvdial/wvdialconf
  64.         if [ "$RET" = "true" ]; then
  65.         db_get wvdial/passphrase
  66.         PASSPHRASE="$RET"
  67.         db_get wvdial/passphrase2
  68.         if [ "$RET" != "$PASSPHRASE" ]; then
  69.             db_input medium wvdial/passphrases_mismatch || true
  70.             db_reset wvdial/passphrase
  71.             db_reset wvdial/passphrase2
  72.             db_fset wvdial/passphrase seen false
  73.             db_fset wvdial/passphrase2 seen false
  74.             STATE=3
  75.         fi
  76.         fi
  77.         ;;
  78.     esac
  79.  
  80.     if db_go; then
  81.     STATE=$(($STATE + 1))
  82.     else
  83.     STATE=$(($STATE - 1))
  84.     fi
  85. done
  86.